﻿import Taro, { Component } from '@tarojs/taro'
import Index from './pages/index'
import './app.css'
import './fonts/font-awesome.css'
// import 'taro-ui/dist/style/index.scss'
import './custom-theme.scss'
import app from './main.js'


// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }

class App extends Component {
  // pages/doctorpages/editPatientInfo/editPatientInfo

  config = {
    pages: [
      
      // 'pages/test/test',
      // 'pages/index/index',
      // 'pages/doctorpages/start/start', // 启动页
      // 'pages/center/pages/doctorstatus/doctorstatus', // 医生认证结果页

      'pages/doctorpages/start/start', // 启动页
      'pages/doctorpages/firstEntry/firstEntry',//未授权的页面
      'pages/doctorpages/authlogin/authlogin', // 授权登录页
      'pages/doctorpages/authphone/authphone', // 授权获取手机号码 // 开发 要把里面的 pages/doctorpages/blank/blank 注释，生产则打开
      'pages/doctorpages/blank/blank', // 用于获取微信公众号openid
      'pages/doctorpages/homepage/homepage', //医生端首页 Y
      // 'pages/doctorpages/inquiryList/inquiryList',//问卷列表
      // 'pages/doctorpages/inquiry/inquiry',//问卷调查
      'pages/doctorpages/medicalhomepage/medicalhomepage',//病历管理 Y
      'pages/doctorpages/Illness/Illness',
      'pages/doctorpages/createCase/createCase',//添加病历
      'pages/doctorpages/editInspect/editInspect',//编辑检查
      'pages/doctorpages/editCase/editCase',//病历详情
      'pages/doctorpages/editPatientInfo/editPatientInfo',//修改患者信息
      'pages/doctorpages/createCourse/createCourse',//添加病程
      'pages/doctorpages/editCaseImage/editCaseImage',//修改病历照片
      'pages/doctorpages/editCaseInfo/editCaseInfo',//修改基本病情
      'pages/doctorpages/caseDetail/caseDetail',// 病历档案详情
      'pages/doctorpages/courseDetail/courseDetail',//
      'pages/doctorpages/selectPatient/selectPatient',//快速选择
      'pages/doctorpages/adddisease/adddisease',//添加病程 Y
      'pages/doctorpages/webViewContaziner/webViewContaziner',//外部链接显示网页
      'pages/doctorpages/medicalStatus/medicalStatus', //病历操作详情 ---- 
      'pages/doctorpages/aiyanPolular/aiyanPolular',  //科普视频列表
      // 'pages/project/resources/ec-canvas/ec-canvas',//项目进度
        

      // 问诊信息
      // 'pages/doctorpages/dynamicmessage/dynamicmessage',//动态消息 Y
      // 'pages/doctorpages/addresslist/addresslist',//通讯录 Y   ###AB区分
      // 'pages/doctorpages/teaminvite/teaminvite',//邀请协作成员  Y    ###页面复用
      // 'pages/doctorpages/teamlist/teamlist',//团队列表 Y
      // 'pages/doctorpages/applylist/applylist',//好友申请 Y
      // 'pages/doctorpages/newshomepage/newshomepage',//消息主页
      // 'pages/doctorpages/historyrecord/historyrecord',//聊天历史记录
      // 'pages/doctorpages/systemnewslist/systemnewslist',//系统消息列表 Y
      // 'pages/doctorpages/systemnews/systemnews',//系统消息 Y
      // 'pages/doctorpages/dialog/dialog',//对话页面
    
      // //转诊 y
      'pages/doctorpages/xuanZeJieZhenYiSheng/xuanZeJieZhenYiSheng',//选择接诊医生 Y 
      'pages/doctorpages/zhuanzhenHuanZhe/zhuanzhenHuanZhe',//转诊患者 Y
      
      //newpages 测试
      // 'pages/doctorpages/pagetext/pagetext',//1
      // 'pages/doctorpages/chatpage/chatpage',//2
      // 'pages/doctorpages/chatpages/chatpages',//3
      // 'pages/doctorpages/findDoctor/findDoctor',//4
      // 'pages/doctorpages/notFound/notFound',//5
      // 'pages/doctorpages/quicklyFound/quicklyFound',//6         
      // 'pages/doctorpages/patientInformation/patientInformation',//患者信息
      // 'pages/doctorpages/quicklyConsultation/quicklyConsultation',//快速咨询
      // 'pages/doctorpages/howToPhotograph/howToPhotograph',//怎么拍照
      // 'pages/doctorpages/Photograph/Photograph',//拍照
          
      // 患者端c
      // 'pages/patientpages/huanzheshouye/huanzheshouye', //患者首页
      // // 问诊模块 => 快速问诊
      // 'pages/patientpages/chooseconsultation/chooseconsultation',//选择患者
      // 'pages/patientpages/symptomtime/symptomtime',//问题1：症状出现多久
      // 'pages/patientpages/hastreat/hastreat',//问题2：是否有治疗过
      // 'pages/patientpages/hasmedicine/hasmedicine',//问题3：是否有服用药物
      // 'pages/patientpages/illdescription/illdescription',//问题4：病情主诉
      // 'pages/patientpages/eyephoto/eyephoto',//问题5：眼睛照片
      // 'pages/patientpages/illhistory/illhistory',//问题6：既往病史
      // 'pages/patientpages/familyillhistory/familyillhistory',//问题7：家族病史
      // 'pages/patientpages/uploadphoto/uploadphoto',//问题8：上传资料照片
      // 'pages/patientpages/quickpay/quickpay',//快速问诊付费
      // // 问诊模块 => 专家问诊
      // 'pages/patientpages/chooseexpert/chooseexpert',//专家列表=>选择专家
      // 'pages/patientpages/paycost/paycost',//专家咨询付费=>聊天页面
      // 'pages/patientpages/gerenbingli/index',//个人病历 
      // // 预约模块 => 专家预约
      // 'pages/patientpages/appointmentregister/appointmentregister',//预约=>门诊地点，说明，温馨提示
      // 'pages/patientpages/registration/registration',//预约=>挂号，看曾经患者  
      // // 预约模块 => 手术预约 
      // 'pages/patientpages/chooseoperation/chooseoperation',// 手术先不做
      // // 个人中心
      // 'pages/patientpages/dialogend/dialogend',//聊天页面
      // 'pages/patientpages/dialogend.2/dialogend',//聊天记录
      // 'pages/patientpages/doctorpage/doctorpage',//医生主页=>擅长，个人简介，看一次需要的前
      // 'pages/patientpages/mydoctor/mydoctor',//我的医生=>擅长，个人简介
      // 'pages/patientpages/gerenzhongxinzhuye/index', //个人中心
      // 'pages/patientpages/chengyuanliebiao/index', //成员列表
      // 'pages/patientpages/jiangkangdangan/index',//健康档案
      // 'pages/patientpages/dingdanliebiao/index',   //订单列表
      // 'pages/patientpages/guahaoxiangqing/index', //挂号详情
      // 'pages/patientpages/shoushuxiangqing/index', //手术详情
      // 'pages/patientpages/wenzhenxiangqing/index',//问诊详情
      // 'pages/patientpages/wenzhenliebiao/index',//问诊列表
      // 'pages/patientpages/dianzibingli/dianzibingli',//电子病历
      // // 优惠券
      // 'pages/patientpages/youhuiquan/index',//优惠券=>兑换优惠券
      // 'pages/patientpages/wodeyouhuiquan/index',//我的优惠券=>优惠券列表
      // // 搜索
      // 'pages/patientpages/sousuomukuai/index',//搜索模块
      // 'pages/patientpages/sousuojieguo/index',//搜索结果
      // 'pages/patientpages/wenzhangyemian/index',//文章页面
      // 'pages/patientpages/sousuoyishengliebiao/index',//搜索更多医生列表
      // 'pages/patientpages/sousuowenzhangliebiao/index',//搜索更多文章列表
      // 'pages/patientpages/kepushipin/index',//科普视频
      // 'pages/patientpages/shipinbofang/index',//视频播放
      // // 推荐专家
      // 'pages/patientpages/tuijianzhuanjia/index',

    ],
    subpackages: [
      {
        "root": "pages/prl/",
        "pages": [
          'pages/yishengdingdanliebiao/yishengdingdanliebiao',//PRL订单列表 -1
          'pages/shuruhuanzhexinxi/shuruhuanzhexinxi',//PRL订单患者详情输入 -2
          'pages/dingdanhuanzhexiangqing/dingdanhuanzhexiangqing',//PRL订单患者详情 - X
        ]
      },
      {
        "root": "pages/project/",
        "pages": [
          'pages/projecthomepage/projecthomepage',//项目首页
          'pages/projectdetails/projectdetails',//项目详情    
          'pages/xiangmubingli/xiangmubingli',//项目病历 
          'pages/projectnotfound/projectnotfound',//项目空
          'pages/projectstatistics/projectstatistics',//项目统计
          'pages/projectpersonal/projectpersonal',//项目个人进度和项目病历
          'pages/xiangmufenxi/xiangmufenxi',//项目分析  
          'pages/xiangmujindu/xiangmujindu',//项目进度
         
        ]
      },
      {
        "root": "pages/flow/",
        "pages": [
          'pages/tianjiahuanzhe/tianjiahuanzhe',//添加患者 Y
          'pages/suifangHuanzheLieBiao/suifangHuanzheLieBiao',//随访患者列表 Y
          'pages/labelmanage/labelmanage',//患者标签管理 Y
          'pages/editlabel/editlabel',//编辑标签 Y
          'pages/choosepatient/choosepatient',//选择患者到标签Y
          // 'pages/qunfaxiaoxifasong/qunfaxiaoxifasong',//发送群发消息 Y
          // 'pages/xuanzeshouxinren/xuanzeshouxinren',//选择收信人 Y
          // 'pages/qunfazhuangtai/qunfazhuangtai',//群发状态    
          'pages/suifangjihua/suifangjihua',//随访模板列表 
          'pages/suifangjihuadoing/suifangjihuadoing', //进行中的随访计划 Y    
          'pages/confirmsuifangfangan/confirmsuifangfangan',//随访方案 Y  
          'pages/editsuifangfangan/editsuifangfangan',//编辑随访计划
          'pages/suifangmodel/suifangmodel',//编辑随访模板
          'pages/suifangdialog/suifangdialog',//确定随访方案后的聊天页面   Y OR N  // 未启用 
          'pages/Char/suifangdialog',// (原)确定随访方案后的聊天页面   Y OR N //未启用
          'pages/suifangjihuaxiangqing/suifangjihuaxiangqing',//随访计划详情
          'pages/patientdetails/patientdetails',//患者详情 Y
          'pages/linkmedical/linkmedical', //关联病历  Y
          'pages/patientlist/patientlist', //全部患者列表
          // 'pages/suifanrili/suifanrili',//随访日历 Y ------
          'pages/patientchoose/patientchoose',//设置患者可选标签 Y  
          'pages/setpatienttag/setpatienttag', //设置患者标签
          'pages/suifangjihuaren/suifangjihuaren',//进行中的随访计划详情 Y     
          'pages/aiyanPolular/aiyanPolular',  //科普视频列表
          'pages/aiyanPolularVideo/aiyanPolularVideo',  //科普视频详情
        ]
      },
      {
        "root": "pages/wenzhen/",
        "pages": [
          'pages/consultpage/consultpage', //咨询页面
          'pages/consultsetting/consultsetting',//设置咨询 
          'pages/wenzhenshezhi/wenzhenshezhi',//问诊设置 Y
          'pages/dingxiangwenzhen/dingxiangwenzhen',//定向问诊
          'pages/operatingguide/operatingguide',//使用指南页面
          'pages/Receipt/Receipt',//快速咨询可接单时间
        ]
      },
      {
        "root": "pages/dynamic/",      // 动态模块
        "pages": [
          'pages/dongtaishouye/dongtaishouye',//动态首页 Y
          'pages/huati/huati',//话题详情 Y
          'pages/fabudongtai/fabudongtai',//发布动态 Y
          'pages/dongtaixiangqing/dongtaixiangqing',//动态详情 Y
          'pages/pinglunliebiao/pinglunliebiao',//评论列表 Y
          'pages/wangqihuati/wangqihuati',//往期话题 Y
          'pages/dongtaihaoyou/dongtaihaoyou',//@好友 Y
          'pages/doctorhomepage/doctorhomepage',//医生主页 
          // 'pages/sharedynamic/sharedynamic', //分享至动态
        ]
      },
      {
        "root": "pages/chat/",  // 聊天
        "pages": [
          'pages/Chat/Chat', // 即时聊天
          'pages/chatdetail/chatdetail', // 即时聊天详情页
        ]
      },
      {
        "root": "pages/center/", // 个人中心
        "pages": [
          'pages/collectlist/collectlist',//收藏列表 Y    找不到title字段
          'pages/orderdetails/orderdetails',//订单详情 Y
          'pages/transactionrecord/transactionrecord',//交易记录 Y   
          'pages/mypurse/mypurse',//我的钱包 Y
          'pages/orderrecord/orderrecord',//订单记录 Y
          'pages/cashwithdrawal/cashwithdrawal',//提现
          'pages/personalcenter/personalcenter',//个人中心 Y   
          'pages/xinxiguanli/xinxiguanli', // 信息管理
          'pages/zizhibeian/zizhibeian',//资质备案-信息
          'pages/zizhibeiantupian/zizhibeiantupian',//资质备案-上传图片
          'pages/minecard/minecard', // 我的名片
          'pages/doctorcertified/doctorcertified',//医生认证 Y 
          'pages/tianjiayinghangka/tianjiayinghangka',//添加银行卡   
          'pages/doctorstatus/doctorstatus',  // 医生认证结果页
        ]
      },
      {
        "root": "pages/patientlables/", //病历标签
        "pages": [
          'pages/medical/medical', //添加标签页  
          'pages/labelmanagemedical/labelmanagemedical',//病历标签管理 Y --------
          'pages/editlabelmedical/editlabelmedical',//编辑病历标签 Y --------
          'pages/medicaltolabel/medicaltolabel',//选择病历到标签 Y
          'pages/xuanzexiezuobingli/xuanzexiezuobingli',//选择协作病历 
          'pages/cooperations/cooperations',//协作成员列表  
          'pages/teaminvite/teaminvite',//邀请协作成员
        ]
      }
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: 'WeChat',
      navigationBarTextStyle: 'black',
      enablePullDownRefresh: true
    },
  }
  
  componentDidMount(){
    console.log('app_didmount', this.$router.params);
  }

  componentDidShow(){
    console.log('app_didshow', this.$router.params);
    var params = this.$router.params;
    // 页面是从转发进入
    if (!app.isEmpty(params.scene) && (params.scene == 1007 || params.scene == 1008) && this.isNotInPaths(params.path)) {
      console.log('进入');
      var query = app.obj_to_query(params.query);
      query = !app.isEmpty(query) ? ('?' + query) : '';
      app.share_page = '/' + params.path + query;

      if (app.share_page.indexOf('caseDetail/caseDetail') != -1) {
        app.redirectTo(app.share_page);
      } else {
        app.wxLogin();
      }
    }
  }

  isNotInPaths(path) {
    var paths = [
      'doctorcertified/doctorcertified',
      'zizhibeiantupian/zizhibeiantupian',
      'createCourse/createCourse',
      'editCase/editCase',
      'fabudongtai/fabudongtai'
    ];

    for (var i = 0; i < paths.length; i++) {
      if (path.indexOf(paths[i]) != -1) {
        return false;
      }
    }

    return true;
  }

  componentDidHide(){}

  componentDidCatchError(){}

  componentWillUnmount(){}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render() {
    return (
      <Index />
    )
  }
}

Taro.render(< App />, document.getElementById('app'))